package Test;


import domain.Student1;

import java.util.ArrayList;
import java.util.Scanner;

public class Demo09 {
    public static void main(String[] args) {
        ArrayList<Student1> list = new ArrayList<>();
        Student1 su1 = method();
        Student1 su2 = method();
        Student1 su3 = method();
        list.add(su1);
        list.add(su2);
        list.add(su3);
        System.out.println(list.get(0).getName());
    }
    public static Student1 method(){
        Scanner sc = new Scanner(System.in);
        String name = sc.next();
        int age = sc.nextInt();
        Student1 sty = new Student1(name,age);

        return sty;
    }
}
